﻿<Window x:Class="AmazonGlacierGUI.UI.Views.JobsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="532"
         xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" WindowStartupLocation="CenterScreen"
        >
    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Grid.Row="0">
            <Button Style="{StaticResource ToolBarButton}" Command="{Binding DownloadCommand}">
                <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Image Source="/Assets/Images/DownloadIcon.png" />
                    <TextBlock  Text="Download" HorizontalAlignment="Center"></TextBlock>
                </StackPanel>
            </Button>
            <Button Style="{StaticResource ToolBarButton}" Margin="10,0,0,0" Command="{Binding UploadCommand}">
                <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Image Source="/Assets/Images/UploadIcon.png" />
                    <TextBlock  Text="Upload" HorizontalAlignment="Center"></TextBlock>
                </StackPanel>
            </Button>
            <Button Style="{StaticResource ToolBarButton}" Margin="10,0,0,0"
                             Command="{Binding ResumeCommand,FallbackValue={StaticResource NullCommand}}">
                <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Image Source="/Assets/Images/StartIcon.png" />
                    <TextBlock  Text="Start" HorizontalAlignment="Center"></TextBlock>
                </StackPanel>
            </Button>
            <Button Style="{StaticResource ToolBarButton}" Margin="10,0,0,0"
                             Command="{Binding PauseCommand,FallbackValue={StaticResource NullCommand}}">
                <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Image Source="/Assets/Images/PauseIcon.png" />
                    <TextBlock  Text="Pause" HorizontalAlignment="Center"></TextBlock>
                </StackPanel>
            </Button>
            <Button Style="{StaticResource ToolBarButton}" Margin="10,0,0,0"
                         Command="{Binding RestartCommand,FallbackValue={StaticResource NullCommand}}">
                <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Image Source="/Assets/Images/RestartIcon.png" />
                    <TextBlock  Text="Restart" HorizontalAlignment="Center"></TextBlock>
                </StackPanel>
            </Button>
            <Button Style="{StaticResource ToolBarButton}" Margin="10,0,0,0"
                         Command="{Binding RemoveCommand,FallbackValue={StaticResource NullCommand}}">
                <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Image Source="/Assets/Images/RemoveIcon.png" />
                    <TextBlock  Text="Remove" HorizontalAlignment="Center"></TextBlock>
                </StackPanel>
            </Button>
            <Button Style="{StaticResource ToolBarButton}" Margin="10,0,0,0"
                         Command="{Binding SettingsCommand}">
                <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Image Source="/Assets/Images/SettingsIcon.png" />
                    <TextBlock  Text="Settings" HorizontalAlignment="Center"></TextBlock>
                </StackPanel>
            </Button>
        </StackPanel>

        <ListBox  Grid.Row="1"  ItemsSource="{Binding Jobs}" x:Name="lstJobs" SelectionMode="Extended" >
                <ListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type ListBoxItem}">
                        <Setter Property="IsSelected" Value="{Binding Mode=TwoWay, Path=IsSelected}"/>
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock Text="{Binding StatusMessage}"></TextBlock>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>

                <ListBox.ContextMenu >

                    <!--<ContextMenu  DataContext="{Binding PlacementTarget.SelectedItem, 
                                                        RelativeSource={RelativeSource Self}}" >-->
                    <ContextMenu>
                        <MenuItem Command="{Binding PauseCommand}" Header="Pause">
                        </MenuItem>
                        <MenuItem Command="{Binding ResumeCommand}" Header="Resume">
                        </MenuItem>
                        <MenuItem Command="{Binding RestartCommand}" Header="Restart">
                        </MenuItem>
                        <MenuItem  Header="Remove" Command="{Binding RemoveCommand}" >
                        </MenuItem>
                    <MenuItem  Header="Details" Command="{Binding ShowDetailsCommand}" >
                        </MenuItem>
                </ContextMenu>
                </ListBox.ContextMenu>
            </ListBox>
        
    </Grid>
</Window>
